/* indent size: 2 */

module.exports = app => {
  const DataTypes = app.Sequelize;

    const Model = app.model.define('aged', {
        aged_id: {
            type: DataTypes.INTEGER(10),
            allowNull: false,
            primaryKey: true,
            autoIncrement:true
        },
        name: {
            type: DataTypes.STRING(50),
            allowNull: false
        },
        sex: {
            type: DataTypes.INTEGER(4),
            allowNull: false
        },
        birth: {
            type: DataTypes.INTEGER(4),
            allowNull: false
        },
        phone: {
            type: DataTypes.CHAR(11),
            allowNull: false
        },
        id_card_num: {
            type: DataTypes.CHAR(18),
            allowNull: false
        },
        aged_pic: {
            type: DataTypes.STRING(255),
            allowNull: false
        },
        citizen_card_pic: {
            type: DataTypes.STRING(255),
            allowNull: false
        },
        town_id: {
            type: DataTypes.INTEGER(11),
            allowNull: false
        },
        community_id: {
            type: DataTypes.INTEGER(11),
            allowNull: false
        },
        subdistrict_id: {
            type: DataTypes.INTEGER(11),
            allowNull: false
        },
        house_num: {
            type: DataTypes.STRING(50),
            allowNull: false
        },
        svc_status: {
            type: DataTypes.INTEGER(4),
            allowNull: false,
            defaultValue: '1'
        },
        status: {
            type: DataTypes.INTEGER(4),
            allowNull: false,
            defaultValue: '1'
        },
        last_svc_time: {
            type: DataTypes.TIME,
            allowNull: false,
            defaultValue:'0000-00-00 00:00:00'
        },
        ctime: {
            type: DataTypes.TIME,
            allowNull: false,
            defaultValue:DataTypes.literal('CURRENT_TIMESTAMP')
        },
        mtime: {
            type: DataTypes.TIME,
            allowNull: false,
            defaultValue:DataTypes.literal('CURRENT_TIMESTAMP')
        }
    }, {
        tableName: 'aged'
    });

  Model.associate = function() {

  }

  return Model;
};
